﻿using System;
using System.Linq;
using System.Threading.Tasks;
using Sino.CarGoCome.Core;
using Sino.CarGoCome.Model;
using Sino.CapacityCloud.WebApi;

namespace Sino.CarGoCome.VirtualCoreData
{
    public class MockLoginService : ILoginService
    {
        public async Task<VoidResponse> GetCaptchasAsync(string phoneNumber)
        {
            return new VoidResponse();
        }

        public async Task<LoginResponse> LoginAsync(string phoneNumber, string captchas)
        {
            if (phoneNumber.ToCharArray().Last() == '0')
            {
                return new LoginResponse()
                {
                    Info = new LoginInfo()
                    {
                        HeadImage = @"http://7xiiiw.com1.z0.glb.clouddn.com/Logo.png",
                        IMToken = "Mock IM Token",
                        Point = 9,
                        RealNameState = RealNameState.Pass,
                        Token = "Mock Token",
                        TokenExpirationDate = DateTime.MaxValue,
                        UserName = phoneNumber
                    }
                };
            }
            return new LoginResponse()
            {
                Info = new LoginInfo()
                {
                    HeadImage = @"http://7xiiiw.com1.z0.glb.clouddn.com/Logo.png",
                    IMToken = "Mock IM Token",
                    Point = 9,
                    RealNameState = RealNameState.NotPass,
                    Token = "Mock Token",
                    TokenExpirationDate = DateTime.MaxValue,
                    UserName = phoneNumber
                }
            };

        }

        public async Task<AuthResponse> AuthAsync(string token)
        {
            return new AuthResponse() { ExpirationDate = DateTime.MaxValue, IsAvailable = true,
                Info = new LoginInfo()
                {
                    HeadImage = @"http://7xiiiw.com1.z0.glb.clouddn.com/Logo.png",
                    IMToken = "W2ej6dJ1s2EzgNcFmzQu/7coaB+UgVRccj/TjE2dPgXaRW/adMCSYRAUSRHLUMVt34h/vLLP1pgeIeeJ5Y2DTXFt8fi7dGA4",
                    Point = 9,
                    RealNameState = RealNameState.Pass,
                    Token = "Mock Token",
                    TokenExpirationDate = DateTime.MaxValue,
                    UserName = "18600001111"
                }
            };
        }
    }
}